//
//  ptrwPdCell.m
//  pacc
//
//  Created by 测试 on 2018/6/4.
//  Copyright © 2018年 测试. All rights reserved.
//

#import "ptrwPdCell.h"

@implementation ptrwPdCell

- (void)awakeFromNib {
    // Initialization code
    self.layer.cornerRadius = 5;
    [super awakeFromNib];
    self.docNameLabel.layer.borderColor = baseBlueColor.CGColor;
}

-(void)setFrame:(CGRect)frame{
    frame.size.height -= ZTmargin;
    frame.origin.x += ZTmargin;
    frame.origin.y += ZTmargin;
    frame.size.width -=2*ZTmargin;
    [super setFrame:frame];
}

-(void)setArrData:(pingtairenwuModel *)arrData{
    self.zid=[NSString stringWithFormat:@"%@",arrData.zid];//工单编码
    self.userid=[NSString stringWithFormat:@"%@",arrData.userid];//下单用户ID
    self.orderDesc=[NSString stringWithFormat:@"%@",arrData.orderDesc];//工单名称
    self.doctorld=[NSString stringWithFormat:@"%@",arrData.doctorld];
    self.doctorLevel=[NSString stringWithFormat:@"%@",arrData.doctorLevel];
    self.readType=[NSString stringWithFormat:@"%@",arrData.readType];
    self.price=[NSString stringWithFormat:@"%@",arrData.price];
    self.orderNo=[NSString stringWithFormat:@"%@",arrData.orderNo];
    self.odrStatus=[NSString stringWithFormat:@"%@",arrData.odrStatus];
    self.patientName=[NSString stringWithFormat:@"%@",arrData.patientName];
    self.patientAge=[NSString stringWithFormat:@"%@",arrData.patientAge];
    self.patientSex=[NSString stringWithFormat:@"%@",arrData.patientSex];
    self.ageLabel.text = [ZXToolObj getAge:self.patientAge];
    self.patientIdcard=[NSString stringWithFormat:@"%@",arrData.patientIdcard];
    self.patientPhone=[NSString stringWithFormat:@"%@",arrData.patientPhone];
    self.patientEmail=[NSString stringWithFormat:@"%@",arrData.patientEmail];
    self.pacFromHos=[NSString stringWithFormat:@"%@",arrData.pacFromHos];
    self.pacReadHos=[NSString stringWithFormat:@"%@",arrData.pacReadHos];
    self.pacNumber=[NSString stringWithFormat:@"%@",arrData.pacNumber];
    self.pacPart=[NSString stringWithFormat:@"%@",arrData.pacPart];
    self.pacDevice=[NSString stringWithFormat:@"%@",arrData.pacDevice];
    self.pacDevicePara=[NSString stringWithFormat:@"%@",arrData.pacDevicePara];
    self.updateTime=[ZXToolObj getTimeStringFormtimestamp:[NSString stringWithFormat:@"%@",arrData.updateTime]];
    self.createTime=[ZXToolObj getTimeStringFormtimestamp:[NSString stringWithFormat:@"%@", arrData.createTime]];
    self.creatTimeLabel.text = self.createTime;
    self.doctorid2 =[NSString stringWithFormat:@"%@",arrData.doctorid2];
    [self.docNameLabel setTextColor:titleBlueColor];
    self.doctorName=[NSString stringWithFormat:@"%@",arrData.doctorName2];
    if ([self.doctorName isEqualToString:@"(null)"]||[self.doctorName isEqual:[NSNull null]]) {
        self.doctorName = @"请选择医生";
        [self.docNameLabel setTextColor:titleGlayColor];
    }else self.docNameLabel.text = [NSString stringWithFormat:@"%@", self.doctorName];
    if ([self.docNameLabel.text isEqualToString:@"请选择医生"]) {
        [self.docNameLabel setTextColor:titleGlayColor];
        self.docNameLabel.layer.borderColor = baseGrayColor.CGColor;
    }else{
        [self.docNameLabel setTextColor:titleblackColor];
        self.docNameLabel.layer.borderColor = baseBlueColor.CGColor;

    }
    self.bianhaoLabel.text = self.orderDesc;
    self.patientAge=[ZXToolObj getAge:arrData.patientAge];

    self.ageLabel.text = [NSString stringWithFormat:@"%@岁" ,self.patientAge];
    self.sexLabel.text = self.patientSex;
    self.nameLabel.text = self.patientName;
    self.huanbingbuweiLabel.text = self.pacPart;
    self.orderNoLabel.text = [NSString stringWithFormat:@"%@",arrData.orderNo];

    if ([self.pacDevice isEqualToString:@"CT"]) {
        [self.typeImageView setImage:[UIImage imageNamed:@"ct_l"]];
    }else if ([self.pacDevice isEqualToString:@"CR"]){
        [self.typeImageView setImage:[UIImage imageNamed:@"cr_l"]];
    }else if ([self.pacDevice isEqualToString:@"DR"]){
        [self.typeImageView setImage:[UIImage imageNamed:@"dr_l"]];
    }else if ([self.pacDevice isEqualToString:@"DSA"]){
        [self.typeImageView setImage:[UIImage imageNamed:@"dsa_l"]];
    }else if ([self.pacDevice isEqualToString:@"MG"]){
        [self.typeImageView setImage:[UIImage imageNamed:@"mg_l"]];
    }else if ([self.pacDevice isEqualToString:@"MR"]){
        [self.typeImageView setImage:[UIImage imageNamed:@"mr_l"]];
    }else if ([self.pacDevice isEqualToString:@"RF"]){
        [self.typeImageView setImage:[UIImage imageNamed:@"rf_l"]];
    }else if ([self.pacDevice isEqualToString:@"X-Ray"]){
        [self.typeImageView setImage:[UIImage imageNamed:@"X-Ray"]];
    }else{
        [self.typeImageView setImage:[UIImage imageNamed:@"ct_l"]];
    }
    NSArray *jsonArr = arrData.orderPac;
    
    if ([jsonArr isEqual:[NSNull null]]) {
        NSLog(@"jsonarr=null");
    }
    
    if (jsonArr != nil && ![jsonArr isKindOfClass:[NSNull class]] && jsonArr.count != 0){
        
        //        　　//执行array不为空时的操作
        //
        if (![jsonArr[0] isEqual:[NSNull null]]) {
            self.pacUrl = [jsonArr[0] objectForKey:@"pacUrl"];
            //            NSLog(@"pacUrl-=-%@",_pacUrl);
        }
    }
}


@end
